package com.yifi.system.service;

import com.jfinal.plugin.activerecord.Db;

public class MisPostUserService {

	/**
	 *  过滤当前用户是否有当前菜单的权限
	 * @param ccode
	 * @param menuid
	 * @return 返回是否
	 */
	public boolean checkUserAuth(String ccode,String menuid)
	{
		String sql="select count(id) from mis_post_menu t1,mis_post t2,mis_user_post t3 where t1.cpost=t2.ccode "
				+ "and t2.ccode=t3.cpost and  t1.cwork='"+menuid+"' ";
		if(!ccode.equals("admin"))
		{
			sql+=" and t3.ccode='"+ccode+"' ";
		}
		
		if(Db.queryInt(sql)>0)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}
